home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / emerald / emrldsys.lha / Kernel / DataStructs / kTaskQ.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-08-17  |  1.1 KB  |  39 lines

  1. #include <stdio.h>
  2. #include <sys/types.h>
  3.  
  4.  
  5. #undef integer        /* Silly stdtypes */
  6. #include "Kernel/h/stdTypes.h"
  7. #include "Kernel/h/kEvents.h"
  8. #include "Kernel/h/system.h"
  9.  
  10. /*
  11.  * QueueTask
  12.  *
  13.  * QueueTask(handler, argument)
  14.  *
  15.  * Puts a task on the queue for later execution by the main loop.
  16.  * This code is unprotected, so it should only be called either at
  17.  * interrupt time or while signals are being held.  Handler is the
  18.  * address of the function, and argument is an argument to be passed
  19.  * to the handler (defined as (char *)).
  20.  */
  21.  
  22. void QueueTask(handler, argument)
  23. int (*handler)();
  24. char *argument;
  25. {
  26.     struct TaskQueue *event;
  27.  
  28.     if ((event = TaskDequeue(&FreeQ)) == NULL) {
  29.         ErrMsg("Out of event list elements.  Dropped handler %x.\n", handler);
  30.         return;
  31.     }
  32.     event->handler = handler;
  33.     event->arg = argument;
  34.         enqueue((struct Queue *) &TaskQ, (struct Queue *) event);
  35.         shouldPause = dontPause; /* Make main loop scheduler ignore pause in 
  36.                                     edenPause: A task has arrived on the queue
  37.                                     so don't pause! */
  38. }
  39.